package cn.calm.database.action;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.apache.struts2.osgi.interceptor.ServiceAware;

import cn.calm.commons.action.CurdAction;
import cn.calm.commons.entity.PageMode;
import cn.calm.database.entity.TableInfo;
import cn.calm.database.service.ITableInfoService;

@SuppressWarnings({"rawtypes","unchecked"})
public class TableAction<T extends TableInfo,S extends ITableInfoService<T>> extends
CurdAction<T,S> implements ServiceAware<ITableInfoService> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public String getModeName() {
		return "table";
	}

	@Override
	public PageMode getPageMode() {
		return super.getPageMode();
	}

	@Override
	public Collection<String> getActionErrors() {
		return super.getActionErrors();
	}

	@Override
	public Map<String, List<String>> getFieldErrors() {
		return super.getFieldErrors();
	}
	
	@Override
	public T getT() {
		return super.getT();
	}

	@Override
	public void setServices(List<ITableInfoService> services) {
		service=(S) services.get(0);
	}

	@Override
	public Class<T> getEntityClass() {
		return (Class<T>) TableInfo.class;
	}
}
